package com.openbravo.pos.mant;

import com.openbravo.basic.BasicException;
import com.openbravo.data.gui.JImageEditor;
import com.openbravo.data.user.DirtyManager;
import com.openbravo.data.user.EditorRecord;
import com.openbravo.format.Formats;
import com.openbravo.pos.forms.AppLocal;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.image.BufferedImage;
import java.util.UUID;
import javax.swing.BorderFactory;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.text.Document;

public class FloorsEditor extends JPanel
  implements EditorRecord
{
  private String m_sID;
  private JLabel jLabel3;
  private JPanel jPanel1;
  private JPanel jPanel3;
  private JImageEditor m_jImage;
  private JTextField m_jName;

  public FloorsEditor(DirtyManager paramDirtyManager)
  {
    initComponents();
    this.m_jName.getDocument().addDocumentListener(paramDirtyManager);
    this.m_jImage.addPropertyChangeListener("image", paramDirtyManager);
    writeValueEOF();
  }

  public void writeValueEOF()
  {
    this.m_sID = null;
    this.m_jName.setText(null);
    this.m_jImage.setImage(null);
    this.m_jName.setEnabled(false);
    this.m_jImage.setEnabled(false);
  }

  public void writeValueInsert()
  {
    this.m_sID = UUID.randomUUID().toString();
    this.m_jName.setText(null);
    this.m_jImage.setImage(null);
    this.m_jName.setEnabled(true);
    this.m_jImage.setEnabled(true);
  }

  public void writeValueDelete(Object paramObject)
  {
    Object[] arrayOfObject = (Object[])(Object[])paramObject;
    this.m_sID = Formats.STRING.formatValue(arrayOfObject[0]);
    this.m_jName.setText(Formats.STRING.formatValue(arrayOfObject[1]));
    this.m_jImage.setImage((BufferedImage)arrayOfObject[2]);
    this.m_jName.setEnabled(false);
    this.m_jImage.setEnabled(false);
  }

  public void writeValueEdit(Object paramObject)
  {
    Object[] arrayOfObject = (Object[])(Object[])paramObject;
    this.m_sID = Formats.STRING.formatValue(arrayOfObject[0]);
    this.m_jName.setText(Formats.STRING.formatValue(arrayOfObject[1]));
    this.m_jImage.setImage((BufferedImage)arrayOfObject[2]);
    this.m_jName.setEnabled(true);
    this.m_jImage.setEnabled(true);
  }

  public Object createValue()
    throws BasicException
  {
    Object[] arrayOfObject = new Object[3];
    arrayOfObject[0] = this.m_sID;
    arrayOfObject[1] = this.m_jName.getText();
    arrayOfObject[2] = this.m_jImage.getImage();
    return arrayOfObject;
  }

  public Component getComponent()
  {
    return this;
  }

  public void refresh()
  {
  }

  private void initComponents()
  {
    this.jPanel1 = new JPanel();
    this.jLabel3 = new JLabel();
    this.m_jName = new JTextField();
    this.jPanel3 = new JPanel();
    this.m_jImage = new JImageEditor();
    setLayout(new BorderLayout());
    this.jPanel1.setPreferredSize(new Dimension(150, 100));
    this.jPanel1.setLayout(null);
    this.jLabel3.setText(AppLocal.getIntString("Label.Name"));
    this.jPanel1.add(this.jLabel3);
    this.jLabel3.setBounds(20, 20, 90, 20);
    this.jPanel1.add(this.m_jName);
    this.m_jName.setBounds(110, 20, 180, 18);
    add(this.jPanel1, "North");
    this.jPanel3.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0));
    this.jPanel3.setLayout(new BorderLayout());
    this.jPanel3.add(this.m_jImage, "Center");
    add(this.jPanel3, "Center");
  }
}

/* Location:           D:\PowerFulPOS-2.30.2\openbravopos.jar
 * Qualified Name:     com.openbravo.pos.mant.FloorsEditor
 * JD-Core Version:    0.6.0
 */